using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.Xml;

namespace Acms.AcmsControls
{
    [Serializable]
    public abstract class BaseContentControlProperties : IXmlSerializable
    {
        System.Xml.Schema.XmlSchema IXmlSerializable.GetSchema()
        {
            return null;
        }


        public virtual void ReadXml(System.Xml.XmlReader reader)
        {
            if (reader.HasAttributes)
            {
                while (reader.MoveToNextAttribute())
                {
                    ReadValue(reader);
                }
                reader.MoveToElement();
            }
            while (reader.Read())
            {
                if (reader.AttributeCount > 0)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        ReadValue(reader);
                    }
                    reader.MoveToElement();
                }
                ReadValue(reader);
            }
        }

        protected abstract void ReadValue(System.Xml.XmlReader reader);

        public void WriteXml(System.Xml.XmlWriter writer)
        {
            WriterPropertiesToXml(writer);
        }

        protected abstract void WriterPropertiesToXml(XmlWriter writer);

    }
}
